<!doctype html>
<html lang="en">
<head>
    <title>Code coverage report for src/assets/octopus/engine/request.js</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="..\..\..\..\prettify.css" />
    <link rel="stylesheet" href="..\..\..\..\base.css" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style type='text/css'>
        .coverage-summary .sorter {
            background-image: url(..\..\..\..\sort-arrow-sprite.png);
        }
    </style>
</head>
<body>
<div class='wrapper'>
  <div class='pad1'>
    <h1>
      <a href="..\..\..\..\index.html">All files</a> / <a href="index.html">src/assets/octopus/engine</a> request.js
    </h1>
    <div class='clearfix'>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Statements</span>
        <span class='fraction'>0/162</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Branches</span>
        <span class='fraction'>0/66</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Functions</span>
        <span class='fraction'>0/36</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Lines</span>
        <span class='fraction'>0/159</span>
      </div>
    </div>
  </div>
  <div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510</td><td class="line-coverage quiet"><span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js"><span class="cstat-no" title="statement not covered" >import {oRequest_CookieEngine} from "./request_cookie";</span>
<span class="cstat-no" title="statement not covered" >import {oRequest_LocalStorageEngine} from "./request_locatstorage";</span>
<span class="cstat-no" title="statement not covered" >import {oRequest_APIEngine} from "./request_api";</span>
<span class="cstat-no" title="statement not covered" >import {oSecurityEngine} from "./security";</span>
&nbsp;
function <span class="fstat-no" title="function not covered" >oRequestEngine(engine) {</span>
&nbsp;
<span class="cstat-no" title="statement not covered" >  this.engine = engine;</span>
<span class="cstat-no" title="statement not covered" >  this.ajaxSequence = 0; // 防止ajax错乱，因为异步返回有延迟，可能先发起的后面才回来，所以需要加一个下标索引，针对特殊请求，可判断先后顺序。</span>
<span class="cstat-no" title="statement not covered" >  this.ajaxQueryList = [];</span>
<span class="cstat-no" title="statement not covered" >  this.init();</span>
}
&nbsp;
oRequestEngine.prototype = {
  // 继承插件初始化函数
  init: <span class="fstat-no" title="function not covered" >function () </span>{
    let o = <span class="cstat-no" title="statement not covered" >this;</span>
&nbsp;
    // 初始化cookies组件
<span class="cstat-no" title="statement not covered" >    this.cookie = new oRequest_CookieEngine(this.engine);</span>
    // 初始化localstorage，后续如果函数变多，可随时扩展为插件。
<span class="cstat-no" title="statement not covered" >    this.localstorage = new oRequest_LocalStorageEngine(this.engine);</span>
    // 初始化安全模块
<span class="cstat-no" title="statement not covered" >    this.security = new oSecurityEngine(this.engine);</span>
    // 初始化接口模块（自带令牌认证）
<span class="cstat-no" title="statement not covered" >    this.api = new oRequest_APIEngine(this.engine);</span>
    // 生成加载遮罩
<span class="cstat-no" title="statement not covered" >    this.mask = $(document.createElement("div"));</span>
<span class="cstat-no" title="statement not covered" >    this.loadProcess = 0;</span>
<span class="cstat-no" title="statement not covered" >    if (this.engine.tools.isMobile()) {</span>
<span class="cstat-no" title="statement not covered" >      this.mask.addClass("maskApp");</span>
    } else {
<span class="cstat-no" title="statement not covered" >      this.mask.addClass("mask");</span>
    }
    //////////////////////////////////////// 获取配置数据 ///////////////////////////////////////////
    // 以下是异步的
    // $.getScript("/static/conf.js", function () {
    //   // 加载模式
    //   o.engine.config = conf;
    //   conf = null;
    // });
<span class="cstat-no" title="statement not covered" >    this.getScript("/static/conf.js", false, <span class="fstat-no" title="function not covered" >function () </span>{</span>
      // data = conf;
<span class="cstat-no" title="statement not covered" >      o.engine.config = conf;</span>
<span class="cstat-no" title="statement not covered" >      conf = null;</span>
    });
&nbsp;
    //////////////////////////// 从Localstorage中获取Passport的数据//////////////////////////////////
    let user_passport = <span class="cstat-no" title="statement not covered" >this.localstorage.get("user_passport");</span>
    // 如果有护照数据，则填充至框架。
<span class="cstat-no" title="statement not covered" >    if (!this.engine.tools.IsNullOrEmpty(user_passport)) {</span>
<span class="cstat-no" title="statement not covered" >      this.engine.passport = user_passport;</span>
    }
  },
  getScript: <span class="fstat-no" title="function not covered" >function (</span>url, async, callback) {
<span class="cstat-no" title="statement not covered" >    this.getAjax("GET", "script", url, async, null, callback);</span>
  },
  getJSON: <span class="fstat-no" title="function not covered" >function (</span>url, callback) {
<span class="cstat-no" title="statement not covered" >    this.getAjax("GET", "json", url, false, null, callback);</span>
  },
  getJSONP: <span class="fstat-no" title="function not covered" >function (</span>url, data, callback) {
<span class="cstat-no" title="statement not covered" >    this.getAjax("GET", "jsonp", url, false, data, callback);</span>
  },
  getHTML: <span class="fstat-no" title="function not covered" >function (</span>url, success, error) {
    // 尝试使用vue-resource插件实现资源的加载
<span class="cstat-no" title="statement not covered" >    this.engine.vue.$http.get(url)</span>
      .then(<span class="fstat-no" title="function not covered" >(</span>response) =&gt; {
<span class="cstat-no" title="statement not covered" >        if (success) {</span>
<span class="cstat-no" title="statement not covered" >          success(response.data);</span>
        }
      })
      .catch(<span class="fstat-no" title="function not covered" >function (</span>response) {
<span class="cstat-no" title="statement not covered" >        if (error) {</span>
<span class="cstat-no" title="statement not covered" >          error(response);</span>
        }
      });
    // 读取本地资源时，以下方式不兼容vue，因为被VUE的路由档掉了，外部地址是正常的。
    // this.getAjax("GET", "html", url, async, null, success, error);
  },
  // 这个方法是getAjax的后台轮询监听方法。
  pollingAjax: <span class="fstat-no" title="function not covered" >function () </span>{
    let sDate = <span class="cstat-no" title="statement not covered" >new Date();  //开始时间</span>
    let o = <span class="cstat-no" title="statement not covered" >this;</span>
    let processQuery = <span class="cstat-no" title="statement not covered" >null;</span>
&nbsp;
    // 这里因为涉及到读配置，在初期读配置的时候还没有加载tips，所以这里会报错。
    // 只有config读取文件配置时是没有的，/static/conf.js 这个没有，后面都有了。
<span class="cstat-no" title="statement not covered" >    if (this.engine.tips) {</span>
<span class="cstat-no" title="statement not covered" >      this.engine.tips.debug("[" + this.engine.tools.date("yyyy/MM/dd HH:mm:ss") + "] 请求引擎队列长度：" + this.ajaxQueryList.length);</span>
    }
&nbsp;
<span class="cstat-no" title="statement not covered" >    $(this.ajaxQueryList).each(<span class="fstat-no" title="function not covered" >function (</span>index, item) {</span>
      // 找到需要处理的Ajax请求
<span class="cstat-no" title="statement not covered" >      if (item.status == 0) {</span>
<span class="cstat-no" title="statement not covered" >        item.status = 777;// 标记为已处理,7是我的幸运数字，哈哈哈。</span>
<span class="cstat-no" title="statement not covered" >        processQuery = item; // 赋值</span>
<span class="cstat-no" title="statement not covered" >        return false; // 找到一个则跳出，执行完Ajax回调触发下一轮询。</span>
      }
    });
&nbsp;
    // 判断是否找到Ajax任务
<span class="cstat-no" title="statement not covered" >    if (processQuery != null) {</span>
      // 执行Ajax请求，成功后调用setTimeout
<span class="cstat-no" title="statement not covered" >      $.ajax({</span>
        type: processQuery.type,
        dataType: processQuery.dataType,// script/json/xml/html/text/jsonp
        cache: false,
        async: processQuery.async,// true：异步；false：同步；因为有大量并发，所以必须改成同步，否则会导致数据错乱。及其严重。
        url: processQuery.url,
        contentType: 'application/json',//charset=utf-8
        // 这里做判断主要是百度接口采用jsonp，而且是不能转义的。。目前偷懒，如果后续还有特殊类型，是否JSON转移需要设置一个属性的。
        data: (processQuery.dataType == "jsonp" ? processQuery.data : JSON.stringify(processQuery.data))
      }).done(<span class="fstat-no" title="function not covered" >function (</span>rdata) {
&nbsp;
        // 只有config读取文件配置时是没有的，/static/conf.js 这个没有，后面都有了。
<span class="cstat-no" title="statement not covered" >        if (o.engine.tips) {</span>
<span class="cstat-no" title="statement not covered" >          o.engine.tips.debug("[" + o.engine.tools.date("yyyy/MM/dd HH:mm:ss") + "] 请求地址：" + processQuery.url</span>
            + ", 请求数据：");
<span class="cstat-no" title="statement not covered" >          console.log(processQuery.data);</span>
<span class="cstat-no" title="statement not covered" >          console.log("请求地址返回：");</span>
<span class="cstat-no" title="statement not covered" >          console.log(rdata);</span>
        }
        // 记录总时间、执行顺序
<span class="cstat-no" title="statement not covered" >        if (rdata.status) {</span>
          // 记录Ajax完整阶段的执行时间。
<span class="cstat-no" title="statement not covered" >          rdata.status.totalTimer = executeTime();</span>
<span class="cstat-no" title="statement not covered" >          rdata.status.sequenceIndex = processQuery.sequence;</span>
        }
        // 触发回调
<span class="cstat-no" title="statement not covered" >        if (processQuery.callback) {</span>
<span class="cstat-no" title="statement not covered" >          processQuery.callback(rdata);</span>
        }
&nbsp;
        // 执行成功，将当前项删除，curr：循环项，i：索引。
<span class="cstat-no" title="statement not covered" >        o.ajaxQueryList = $.grep(o.ajaxQueryList, <span class="fstat-no" title="function not covered" >function (</span>curr, i) {</span>
<span class="cstat-no" title="statement not covered" >          return curr != processQuery;</span>
        });
&nbsp;
        // 执行成功以后，瞬时启动下一个循环。
<span class="cstat-no" title="statement not covered" >        o.pollingAjax();</span>
&nbsp;
        // 有一个bug，当断网的时候，这个队列会越来越多？。。
&nbsp;
&nbsp;
        ///////////////////////////////////////////////////
&nbsp;
      }).fail(<span class="fstat-no" title="function not covered" >function (</span>msg) {
        // 能走到这里的一定是八爪鱼API无法处理的，一般情况下这是不可能的，因为八爪鱼API全部会通过Status Code来表达异常，而不会报错。
<span class="cstat-no" title="statement not covered" >        if (processQuery.callback) {</span>
          let edata = <span class="cstat-no" title="statement not covered" >{</span>
            content: "",
            status: {code: 500, message: msg.responseText || "未请求到资源，请确保资源的有效性。"},
            totalTimer: executeTime()
          };
<span class="cstat-no" title="statement not covered" >          processQuery.callback(edata);</span>
        }
&nbsp;
        //执行失败以后，延时2秒再次请求。
<span class="cstat-no" title="statement not covered" >        setTimeout(<span class="fstat-no" title="function not covered" >function () </span>{</span>
          // 重置为未获取状态。
<span class="cstat-no" title="statement not covered" >          processQuery.status = 0;</span>
<span class="cstat-no" title="statement not covered" >          o.pollingAjax();</span>
        }, 2000);
&nbsp;
      });
    } else {
      // 如果请求队列还有数据，则继续执行循环，如果队列清空，则监听停止，防止浏览器死机。
<span class="cstat-no" title="statement not covered" >      if (this.ajaxQueryList.length &gt; 0) {</span>
<span class="cstat-no" title="statement not covered" >        setTimeout(<span class="fstat-no" title="function not covered" >function () </span>{</span>
<span class="cstat-no" title="statement not covered" >          o.pollingAjax();</span>
        }, 1);
      } else {
        // 确认没有请求数据了，隐藏遮罩。
<span class="cstat-no" title="statement not covered" >        this.hiddenMask();</span>
      }
    }
&nbsp;
    // 获取计算时间
    function <span class="fstat-no" title="function not covered" >executeTime() {</span>
      let diff_date = <span class="cstat-no" title="statement not covered" >new Date() - sDate.getTime();  //时间差的毫秒数</span>
      let diff_second = <span class="cstat-no" title="statement not covered" >diff_date % (24 * 3600 * 1000);    //计算天数后剩余的毫秒数</span>
      // return (diff_second / 1000) + "s";
<span class="cstat-no" title="statement not covered" >      return (diff_second / 1000);</span>
    }
  },
  // 发起Ajax请求，其实这边是统一接口，然后存入Ajax队列，pollingAjax方法会调度执行里面的代码
  getAjax: <span class="fstat-no" title="function not covered" >function (</span>type, dataType, url, async, data, callback) {
    // 记录流水号
<span class="cstat-no" title="statement not covered" >    this.ajaxSequence = this.ajaxSequence + 1;</span>
    // 将Ajax请求追加至Ajax Query List，如果请求列表已经为0，则重新启动触发器。
<span class="cstat-no" title="statement not covered" >    this.ajaxQueryList.push({status: 0, sequence: this.ajaxSequence, type, dataType, url, async, data, callback});</span>
    // 如果只有当前1条任务，则说明之前监听已经结束，现在重新启动。
<span class="cstat-no" title="statement not covered" >    if (this.ajaxQueryList.length == 1) {</span>
      // 新启动任务时触发遮罩
<span class="cstat-no" title="statement not covered" >      this.showMask();</span>
      // 启动任务
<span class="cstat-no" title="statement not covered" >      this.pollingAjax();</span>
    }
&nbsp;
    // 标准Ajax版本，但是这个版本会有致命的并发缺陷及回调地狱。
<span class="cstat-no" title="statement not covered" >    if (false) {</span>
      let sDate = <span class="cstat-no" title="statement not covered" >new Date();  //开始时间</span>
      //console.log("ajax.type:" + type + ",async:" + async + ",dataType:" + dataType + ",url:" + url + ",data:" + JSON.stringify(data));
<span class="cstat-no" title="statement not covered" >      $.ajax({</span>
        type: type,
        dataType: dataType,// script/json/xml/html/text
        cache: false,
        async: async,// true：异步；false：同步；因为有大量并发，所以必须改成同步，否则会导致数据错乱。及其严重。
        url: url,
        contentType: 'application/json; charset=utf-8',
        data: JSON.stringify(data),
        beforeSend: <span class="fstat-no" title="function not covered" >function () </span>{
&nbsp;
        },
        complete: <span class="fstat-no" title="function not covered" >function (</span>data) {
          // console.log("cccc: " + JSON.data);
        },
        success: <span class="fstat-no" title="function not covered" >function (</span>rdata) {
<span class="cstat-no" title="statement not covered" >          if (callback) {</span>
<span class="cstat-no" title="statement not covered" >            callback(rdata);</span>
          }
        },
        error: <span class="fstat-no" title="function not covered" >function (</span>msg) {
          // 能走到这里的一定是八爪鱼API无法处理的，一般情况下这是不可能的，因为八爪鱼API全部会通过Status Code来表达异常，而不会报错。
<span class="cstat-no" title="statement not covered" >          if (callback) {</span>
            let diff_date = <span class="cstat-no" title="statement not covered" >new Date() - sDate.getTime();  //时间差的毫秒数</span>
            let diff_second = <span class="cstat-no" title="statement not covered" >diff_date % (24 * 3600 * 1000)    //计算天数后剩余的毫秒数</span>
            let edata = <span class="cstat-no" title="statement not covered" >{</span>
              content: "",
              status: {code: 500, message: msg.responseText || "未请求到资源，请确保资源的有效性。"},
              timer: (diff_second / 1000) + "s"
            };
<span class="cstat-no" title="statement not covered" >            callback(edata);</span>
          }
        }
      });
    }
&nbsp;
    // H5 web worker test
<span class="cstat-no" title="statement not covered" >    if (false) {</span>
      // VUE-Worker组件写法，比较简单，提供run和create方法，其中run比较简单。
      let worker = <span class="cstat-no" title="statement not covered" >this.engine.vue.$worker.run(<span class="fstat-no" title="function not covered" >function (</span>e) {</span>
<span class="cstat-no" title="statement not covered" >        return {name: "marco", age: 31};</span>
      }, [{type, dataType, url, async, data}])
        .then(<span class="fstat-no" title="function not covered" >function (</span>res) {
<span class="cstat-no" title="statement not covered" >          o.engine.tips.debug(JSON.stringify(res));</span>
        })
        .catch(<span class="fstat-no" title="function not covered" >function (</span>e) {
<span class="cstat-no" title="statement not covered" >          console.log(e);</span>
          //o.engine.tips.error(e);
<span class="cstat-no" title="statement not covered" >          callback({</span>
            content: "",
            status: {code: 500, message: e.message}
          });
        });
<span class="cstat-no" title="statement not covered" >      worker = null;// 通过赋值null的方式，释放掉worker引用，这样就可以关闭worker，这是作者在github上说的</span>
&nbsp;
&nbsp;
      // 测试H5新特性 Worker 原生写法
      // let worker = new Worker("/static/request.js");
      // // let worker = new Worker("/static/resource/script/work/request.js");
      // //最好先判断浏览器是否支持worker,我的项目用的是谷歌，所以就不判断了！
      // worker.postMessage({
      //   type: "all",
      //   url: url,
      //   data: data
      // });
      // //发送消息到worker.js中
      // worker.addEventListener("message", function (handle) {
      //   console.log("Master接收到消息："+JSON.stringify(handle));
      // });
    }
  },
  getUpload: <span class="fstat-no" title="function not covered" >function (</span>url, data, beforeCallback, completedCallback) {
    // 赋默认值
<span class="cstat-no" title="statement not covered" >    data.size = data.size || 720;</span>
<span class="cstat-no" title="statement not covered" >    data.quality = data.quality || 0.95;</span>
    // 因为element-ui的上传空控件并不返回base64编码的内容，所以全部需要统一的file转base64自己的实现才行。
<span class="cstat-no" title="statement not covered" >    this.getUploadByCompress(data, <span class="fstat-no" title="function not covered" >function (</span>compressFile) {</span>
      // 确保有之前函数
<span class="cstat-no" title="statement not covered" >      if (beforeCallback) {</span>
        // 如果确认通过，则执行上传。
<span class="cstat-no" title="statement not covered" >        if (beforeCallback(compressFile)) {</span>
<span class="cstat-no" title="statement not covered" >          console.log(data.file);</span>
<span class="cstat-no" title="statement not covered" >          console.log(compressFile);</span>
&nbsp;
          // 执行上传
          let formData = <span class="cstat-no" title="statement not covered" >new FormData();</span>
<span class="cstat-no" title="statement not covered" >          formData.append("file", compressFile);// 此处file名称要和后台API保持一致。</span>
<span class="cstat-no" title="statement not covered" >          $.ajax({</span>
            url: url, /*接口域名地址*/
            type: 'post',
            data: formData,
            contentType: false,
            processData: false,
            success: <span class="fstat-no" title="function not covered" >function (</span>cdata) {
<span class="cstat-no" title="statement not covered" >              if (completedCallback) {</span>
<span class="cstat-no" title="statement not covered" >                completedCallback(cdata);</span>
              }
            }
          });
        }
        // else{
        //   alert("未通过before验证。");
        // }
      }
    });
  },
  getUploadByCompress: <span class="fstat-no" title="function not covered" >function (</span>data, callback) {
    let reader = <span class="cstat-no" title="statement not covered" >new FileReader();</span>
    //这里把一个文件用base64编码
<span class="cstat-no" title="statement not covered" >    reader.readAsDataURL(data.file);</span>
<span class="cstat-no" title="statement not covered" >    reader.onload = <span class="fstat-no" title="function not covered" >function (</span>e) {</span>
      // 转换成base64编码
      let base64Data = <span class="cstat-no" title="statement not covered" >e.target.result;</span>
      // console.log("获取文件对象数据流：" + base64Data);
      // 创建Canvas对象(画布)
      let canvas = <span class="cstat-no" title="statement not covered" >document.createElement('canvas')</span>
      // 获取对应的CanvasRenderingContext2D对象(画笔)
      let context = <span class="cstat-no" title="statement not covered" >canvas.getContext('2d')</span>
      // 创建新的图片对象
      let img = <span class="cstat-no" title="statement not covered" >new Image();</span>
      // 指定图片的DataURL(图片的base64编码数据)
<span class="cstat-no" title="statement not covered" >      img.src = base64Data;</span>
      // 监听浏览器加载图片完成，然后进行进行绘制
<span class="cstat-no" title="statement not covered" >      img.onload = <span class="fstat-no" title="function not covered" >() =&gt; </span>{</span>
        // 画面压缩 / 2，然后后面在将画质调整为0.8。
        let proportion = <span class="cstat-no" title="statement not covered" >0.00;</span>
        // 得到720高的整体比例，如果高度占优势，则优化高度，如果宽度占优势，则优化宽度。
<span class="cstat-no" title="statement not covered" >        if (img.height &gt; img.width) {</span>
<span class="cstat-no" title="statement not covered" >          proportion = 1 - ((img.height - data.size) / img.height);</span>
        } else {
<span class="cstat-no" title="statement not covered" >          proportion = 1 - ((img.width - data.size) / img.width);</span>
        }
&nbsp;
        let imgHeight = <span class="cstat-no" title="statement not covered" >img.height * proportion;</span>
        let imgWidth = <span class="cstat-no" title="statement not covered" >img.width * proportion;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" >        console.log("原始：h:" + img.height + ", w:" + img.width + "; 压缩：h:" + parseInt(imgHeight) + ", w:" + parseInt(imgWidth) + "。");</span>
&nbsp;
        // 指定canvas画布大小，该大小为最后生成图片的大小
<span class="cstat-no" title="statement not covered" >        canvas.width = imgWidth;</span>
<span class="cstat-no" title="statement not covered" >        canvas.height = imgHeight;</span>
        /* drawImage画布绘制的方法。(0,0)表示以Canvas画布左上角为起点，400，300是将图片按给定的像素进行缩小。
        如果不指定缩小的像素图片将以图片原始大小进行绘制，图片像素如果大于画布将会从左上角开始按画布大小部分绘制图片，最后的图片就是张局部图。*/
<span class="cstat-no" title="statement not covered" >        context.drawImage(img, 0, 0, imgWidth, imgHeight)</span>
        // 将绘制完成的图片重新转化为base64编码，file.file.type为图片类型，0.9为压缩质量。
        let base64DataCompress = <span class="cstat-no" title="statement not covered" >canvas.toDataURL(data.file.type, data.quality);</span>
&nbsp;
        // Base64 转 File对象
        let arr = <span class="cstat-no" title="statement not covered" >base64DataCompress.split(','), mime = <span class="cstat-no" title="statement not covered" >arr[0].match(/:(.*?);/)[1],</span></span>
          bstr = <span class="cstat-no" title="statement not covered" >atob(arr[1]), n = <span class="cstat-no" title="statement not covered" >bstr.length, u8arr = <span class="cstat-no" title="statement not covered" >new Uint8Array(n);</span></span></span>
<span class="cstat-no" title="statement not covered" >        while (n--) {</span>
<span class="cstat-no" title="statement not covered" >          u8arr[n] = bstr.charCodeAt(n);</span>
        }
        let blobToFile = <span class="cstat-no" title="statement not covered" >new Blob([u8arr], {type: mime});</span>
&nbsp;
        // 补充File对象信息
<span class="cstat-no" title="statement not covered" >        blobToFile.lastModified = data.file.lastModified;</span>
<span class="cstat-no" title="statement not covered" >        blobToFile.lastModifiedDate = data.file.lastModifiedDate;</span>
<span class="cstat-no" title="statement not covered" >        blobToFile.name = data.file.name;</span>
&nbsp;
<span class="cstat-no" title="statement not covered" >        console.log("原始：" + parseInt(data.file.size / 1024 / 1024) + " MB，压缩：" + parseInt(blobToFile.size / 1024) + " KB");</span>
&nbsp;
        // 回调
<span class="cstat-no" title="statement not covered" >        if (callback) {</span>
          let blob2file = <span class="cstat-no" title="statement not covered" >new window.File([blobToFile], blobToFile.name, {type: blobToFile.type});</span>
<span class="cstat-no" title="statement not covered" >          callback(blob2file);</span>
        }
      }
    }
&nbsp;
    // https://blog.csdn.net/guohao326/article/details/86382024   file to base64
&nbsp;
    // 参考：https://www.cnblogs.com/007sx/p/7583202.html
  },
  showMask: <span class="fstat-no" title="function not covered" >function () </span>{
<span class="cstat-no" title="statement not covered" >    if ($("body").find(".mask").length == 0 &amp;&amp; $("body").find(".maskApp").length == 0) {</span>
      // this.mask.append("&lt;div class='icon icon-73dengdai'&gt;&lt;/div&gt;")
<span class="cstat-no" title="statement not covered" >      this.mask.append("&lt;div class='load'&gt;&lt;/div&gt;")</span>
<span class="cstat-no" title="statement not covered" >      $("body").prepend(this.mask);</span>
    }
&nbsp;
<span class="cstat-no" title="statement not covered" >    this.mask.show();</span>
&nbsp;
    // 因为遮罩只能挡住当前可视区，所以要禁用滚动条，等加载完成后再恢复。
<span class="cstat-no" title="statement not covered" >    $(document.body).css("overflow", "hidden");</span>
&nbsp;
    // 如果是APP，则模拟进度加载。
<span class="cstat-no" title="statement not covered" >    if (this.engine.tools.isMobile()) {</span>
      let loadContent = <span class="cstat-no" title="statement not covered" >$(this.mask).find(".load");</span>
<span class="cstat-no" title="statement not covered" >      this.loadProcess = 0;</span>
<span class="cstat-no" title="statement not covered" >      loadContent.width(this.loadProcess);</span>
&nbsp;
<span class="cstat-no" title="statement not covered" >      this.showMaskByAPPProcess(loadContent);</span>
&nbsp;
    }
  },
  showMaskByAPPProcess: <span class="fstat-no" title="function not covered" >function (</span>loadContent) {
    // 只有大于0，才执行。
    let o = <span class="cstat-no" title="statement not covered" >this;</span>
    let totalWidth = <span class="cstat-no" title="statement not covered" >$(this.mask).width();</span>
    // alert(totalWidth);
    // let loadContent = $(this.mask).find(".load");
<span class="cstat-no" title="statement not covered" >    if (this.loadProcess &lt;= totalWidth) {</span>
      // 一半之前
<span class="cstat-no" title="statement not covered" >      if (this.loadProcess &lt;= totalWidth / 2) {</span>
<span class="cstat-no" title="statement not covered" >        this.loadProcess = this.loadProcess + 20;</span>
      }
      // 完成三分之二了，加5个。
      else <span class="cstat-no" title="statement not covered" >if ((this.loadProcess / totalWidth) &lt;= 0.8) {</span>
<span class="cstat-no" title="statement not covered" >        this.loadProcess = this.loadProcess + 5;</span>
      }
      // 超过加1个。
      else {
<span class="cstat-no" title="statement not covered" >        this.loadProcess = this.loadProcess + 1;</span>
      }
&nbsp;
<span class="cstat-no" title="statement not covered" >      loadContent.width(this.loadProcess);</span>
<span class="cstat-no" title="statement not covered" >      setTimeout(<span class="fstat-no" title="function not covered" >function () </span>{</span>
<span class="cstat-no" title="statement not covered" >        o.showMaskByAPPProcess(loadContent);</span>
&nbsp;
      }, 500);
    }
  },
  hiddenMask: <span class="fstat-no" title="function not covered" >function () </span>{
    // 隐藏进度条
<span class="cstat-no" title="statement not covered" >    this.mask.hide();</span>
    //
<span class="cstat-no" title="statement not covered" >    $(document.body).css("overflow", "auto");</span>
  },
  // 备份方法，八爪鱼框架可使用的组件，包含：vue-resource、axios、jquery
  bak: <span class="fstat-no" title="function not covered" >function () </span>{
    // let src_conf = $(document.createElement("script"));
    // src_conf.attr("type", "text/javascript");
    // src_conf.attr("src", "/static/conf.js");
    // $("body").append(src_conf);
    // console.log(getConfig());
&nbsp;
    // 以下是同步的方式，会引起浏览器阻塞，但是会引起浏览器的警告，异步没有警告。
    // $.ajax({
    //   url: "/static/conf.js",
    //   async: false,//同步的方式（产生阻塞，因为必须要动态获取配置才行，也就一次，可以等。）
    //   dataType: "script",//script html json xml jsonp text
    //   success: function () {
    //     data = conf;
    //   },
    //   error: function (msg) {
    //   }
    // });
&nbsp;
    // 以下采用八爪鱼Request引擎获取脚本数据。
    // this.request.getScript("/static/conf.js", false, function () {
    //   data = conf;
    // }, function (msg) {
    //
    // });
&nbsp;
    // 利用vue-resource异步获取，但是这个方法取得的资源都是静态资源。。。
    // this.v.$http.get("/static/conf.js")
    //   .then((response) =&gt; {
    //     // console.log(response.data);
    //     // let conf = eval("conf=" + response.bodyText);
    //     // let conf = response.data;
    //     // o.conf = conf;
    //     //
    //     // console.log("vue-resource get json:" + o.conf.url);
    //   })
    //   .catch(function (response) {
    //     console.error(response);
    //   });
    // console.log("vue-resource get json:" + this.conf);
&nbsp;
    // 以下是异步的方式，但是会引起浏览器警告。
    // $.getScript("/static/conf.js", function () {
    //   // 加载模式
    //   //this.model = conf.model;
    //   //alert(JSON.stringify(this));
    //   o.conf = getConfig();
    //   console.log(getConfig());
    //   // 此处可使用加载的JS
    //   // testTemplateFun();
    // });
    // console.log(this.conf);
&nbsp;
    // 以下也是异步的方式
    // Axios.get('/static/conf.json')
    //   .then(function (res) {
    //     let conf = res.data;
    //     console.log("Axios get json:" + conf.url)
    //   }).catch(err =&gt; {
    //   console.log(err)
    // });
&nbsp;
    // Axios.post('/static/conf.json',{aaa:123})
    //   .then(function (res) {
    //     let conf = res.data;
    //     console.log("Axios get json:" + conf.url)
    //   }).catch(err =&gt; {
    //   console.log(err)
    // });
  }
}
&nbsp;
export {
  oRequestEngine
}
&nbsp;
&nbsp;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
  Code coverage
  generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Jan 20 2020 17:54:15 GMT+0800 (GMT+08:00)
</div>
</div>
<script src="..\..\..\..\prettify.js"></script>
<script>
window.onload = function () {
        if (typeof prettyPrint === 'function') {
            prettyPrint();
        }
};
</script>
<script src="..\..\..\..\sorter.js"></script>
</body>
</html>
